package fang.controller;


import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

@Controller
public class HelloController {

    @RequestMapping("/hello")
    /*
     * @author xinchao
     * @params model 可以存放数据，放入request作用域
     * @return 返回到视图
     * @exception
     * @date 2021/7/27 20:58
    */
    public String hello(Model model, HttpServletRequest request) {
        model.addAttribute("name", "张三");     // Model 优先级高于request
//        request.setAttribute("name", "李四");
        return "hello";
    }
}
